<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>仿todo_list</title>
	<link rel="stylesheet" href="node_modules/todomvc-common/base.css">
	<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
	<link rel="stylesheet" href="css/app.css">
	<script src="../vue.js"></script>
</head>
<body>
	<section id="todoapp" class="todoapp">
		<header class="header">
			<h1>TodoList</h1>
			<!-- 使用双向数据绑定获取修改数据 不在需要表单对象 -->
			<input v-model.trim="inp_data" @keyup.enter="addTodo" class="new-todo" placeholder="What needs to be done?" autofocus>
		</header>
		<template v-if="todo_data.length">
			<section class="main">
				<!-- 为按钮绑定点击数据,传入事件对象 -->
				<input @click="toggleAll($event)" id="toggle-all" class="toggle-all" type="checkbox">
				<label for="toggle-all">Mark all as complete</label>
				<ul class="todo-list">
					<!-- 使用v-for 循环遍历数据 -->
					<li v-for="(v,k) in todo_data" v-bind:class="{completed:v.stat}">
						<div class="view">
							<!-- 选中与不选中的状态直接使用v-model双向数据绑定来操作即可 -->	
							<input class="toggle" type="checkbox" v-model:checked="v.stat">
							<label>{{v.title}}</label>
							<button @click="removeTodo(k)" class="destroy"></button>
						</div>
						<input class="edit" value="Create a TodoMVC template">
					</li>
				</ul>
			</section>

			<footer class="footer">
				<span class="todo-count"><strong>{{getNu}}</strong> item left</span>
				<ul class="filters">
					<li>
						<a class="selected" href="#/">All</a>
					</li>
					<li>
						<a href="#/active">Active</a>
					</li>
					<li>
						<a href="#/completed">Completed</a>
					</li>
				</ul>
				<button @click="romveCompleted" class="clear-completed">Clear completed</button>
			</footer>
		</template>

	</section>

	<script src="node_modules/todomvc-common/base.js"></script>

	<script src="./js/app.js"></script>
</body>

</html>